package util;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import comment.ApplicationVariable;
import model.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class SessionUtil {
    public static UserInfo getSessionUserInfo(HttpServletRequest req){
        HttpSession session = req.getSession(false);
        UserInfo userInfo = null;
        if(session != null && session.getAttribute(ApplicationVariable.SESSION_USER_KET) != null){
            userInfo = (UserInfo)session.getAttribute(ApplicationVariable.SESSION_USER_KET);
        }
        return  userInfo;
    }
}
